package web.controller;

import java.math.BigDecimal;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import web.service.GoodsService;

@Controller
@RequestMapping("goods")
public class GoodsController {

    @Autowired
    private GoodsService service;

    @RequestMapping("edit")
    @ResponseBody
    public boolean addGood(String name, String price) {
        return service.addGood(name, price);
    }

    @RequestMapping("list")
    @ResponseBody
    public Map<String, Object> queryList(Integer page, Integer size) {
        return service.queryGoods(page, size);
    }

    @RequestMapping("deleteGood")
    @ResponseBody
    public boolean deleteGood(Integer id) {
        return service.deleteGoods(id);
    }

}
